<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>一题库</title>
<link href="/static/bst/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="/static/timeselect//css/jquery-ui-1.9.1.custom.min.css" rel="stylesheet" type="text/css">
<link href="/static/timeselect/css/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="/static/kd/kindeditor-min.js"></script>

<script type="text/javascript" src="/static/jquery.min.js"></script>
<script type="text/javascript" src="/static/timeselect/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/static/timeselect/js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/static/timeselect/js/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript" src="/static/timeselect/js/datetime.custom.js"></script>

</head>

<body>
<{include file="wiget/navbar.tpl"}>

<div class="container">

<form class="form-horizontal" accept-charset="utf-8" autocomplete="on"  method="post" action="/post/vol_op"  >
  <div class="control-group">
    <label class="control-label">标题:</label>
    <div class="controls">
		<input name="title" class="span6" placeholder="试卷标题"/>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label">分类:</label>
    <div class="controls">
		<select name="item" class="span2">
		<option value="">未分类</option>
		<option value="php">php</option>
		<option value="c">c/c++</option>
		<option value="java">java/jsp</option>
		<option value="javascript">js/javascript</option>
		</select>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label">标签:</label>
    <div class="controls">
		<input name="tags" class="span4" placeholder="标签用英/中文逗号隔开,分类自动为标签"/>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label"  >导读:</label>
    <div class="controls">
		<textarea name="intro" class="editor span8" rows="6" placeholder="试卷简介"></textarea>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label"  >发布时间:</label>
    <div class="controls">
		<input type="text" class="datetime_timepicker" name="time" maxlength="30" placeholder="默认立刻发布"/>
    </div>
  </div>
  <hr/>
  <div class="control-group">
    <label class="control-label"><span>试题抽取:</span></label>
	 <a class="label label-warning" onclick="javascirpt:add_editor(this)">增加编辑器</a>
    <div class="controls">
      <textarea type="text" name="ti[]" class="span6" rows="2" placeholder="试题抽取"></textarea>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label"><span>试题抽取:</span></label>
	 <a class="label label-warning" onclick="javascirpt:add_editor(this)">增加编辑器</a>
    <div class="controls">
      <textarea type="text" name="ti[]" rows="2" class="span6" placeholder="试题抽取,不用加序号"></textarea>
    </div>
  </div>
  <div id="ti_group" ></div>
	<div class="control-group">
		<div class="controls">
		<a class="label label-info" onclick="add_ti_group();">继续增加试题</a>
		</div>
	</div>
	<hr/>
  <div class="control-group">
    <div class="controls">
      <button type="submit" name="op" value="vol" class="btn btn-primary">提交试卷</button>
    </div>
  </div>
</form>

</div>

<script>
function add_ti_group() {
	var str = '<div class="control-group">    <label class="control-label"><span>试题抽取:</span></label>  <a class="label label-warning" onclick="javascirpt:add_editor(this)">增加编辑器</a>   <div class="controls">      <textarea type="text" name="ti[]" rows="2" class="span6" placeholder="试题抽取"></textarea>    </div>  </div>';
	$('#ti_group').before(str);
}

function add_editor(obj) {
	//alert('add editor');
	//alert( $(obj).next().html() );
	KindEditor.create($(obj).next(),{items : ['bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'justifyleft', 'justifycenter', 'formatblock', 'insertorderedlist', 'insertunorderedlist', '|','subscript','superscript', 'about','clearhtml', 'code', '|','link', 'unlink', 'emoticons', 'shcode', 'image', 'table', 'quote', '|', 'fullscreen', 'source']});
	$(obj).html('删除编辑器');
	$(obj).attr('onclick','javascript:del_editor(this)');
}
function del_editor(obj) {
	//alert( $(obj).next().next().html() );
	
	$(obj).next().next().remove();
	$(obj).next().remove();
	$(obj).after('<div class="controls"><textarea type="text" name="ti[]" rows="2" class="span6" placeholder="试题抽取"></textarea></div>');
	$(obj).html('增加编辑器');
	$(obj).attr('onclick','javascript:add_editor(this)');
	//KindEditor.remove($(obj).next().next());
}

</script>
<script>
        var editor;
        KindEditor.ready(function(K) {
                editor = K.create('.editor',{items : ['bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'justifyleft', 'justifycenter', 'formatblock', 'insertorderedlist', 'insertunorderedlist', '|','subscript','superscript', 'about','clearhtml', 'code', '|','link', 'unlink', 'emoticons', 'shcode', 'image', 'table', 'quote', '|', 'fullscreen', 'source']});
        });
</script>



<{include file="wiget/footer.tpl"}>